package com.sz.biz.logistics.base.service;

/**
 * Package: com.sz.biz.logistics.base.service <br>
 * Function: TODO: ADD FUNCTION <br>
 * Author: hpeng.wang. <br>
 * Date: 2017-02-16 10:18:00.
 */
public enum CountryAreaType {
    COUNTRY(1),
    CHINAAREA(2),
    ABROADAREA(3),
    POSTCODE(4),
    PORTADDRESS(5),//海运
    AIRADDRESS(6);//空运

    private int value = 0;

    CountryAreaType(int value) {    //    必须是private的，否则编译错误
        this.value = value;
    }

    public static CountryAreaType valueOf(int value) {    //    手写的从int到enum的转换函数
        switch (value) {
            case 1:
                return COUNTRY;
            case 2:
                return CHINAAREA;
            case 3:
                return ABROADAREA;
            case 4:
                return POSTCODE;
            case 5:
                return PORTADDRESS;
            case 6:
                return AIRADDRESS;
            default:
                return null;
        }
    }

    public int value() {
        return this.value;
    }
}

